Skip to content

fix(taskmanager): flush flow runs on Infrahub 1.13, which takes no number of days - #179

Draft
saltas888 wants to merge 3 commits into
mainfrom
flow-runs-task-manager-retention-infp-507
Draft

saltas888 wants to merge 3 commits into
mainfrom
flow-runs-task-manager-retention-infp-507

Conversation

@saltas888

@saltas888 saltas888 commented Oct 13, 2026 •

Copy link
Copy Markdown

Summary

  • Problem: Infrahub 1.13 removes --days-to-keep and --batch-size from infrahub tasks flush flow-runs (opsmill/infrahub#11289): the task manager deletes up to its own task history retention, and --rewrite returns the disk space. infrahub-taskmanager flush flow-runs passes both options. An unknown option is not the "no such command" error that starts the tool's script fallback, so on 1.13 the tool fails.
  • Change: the tool reads infrahub tasks flush flow-runs --help in the task worker and strips ANSI color formatting before checking the options. Forced-color help therefore uses the same detection as plain help.
    • When the help offers --rewrite and no --days-to-keep (1.13 and later), the tool runs infrahub tasks flush flow-runs, with --rewrite when the new --rewrite flag is given. It warns when days_to_keep or batch_size were given, because those releases ignore them, and names the setting to use instead: INFRAHUB_TASK_MANAGER_RETENTION_TASK_HISTORY.
    • Otherwise the tool behaves as before, including the script fallback for releases without the command. --rewrite is then ignored, with a warning.
    • flush stale-runs is unchanged: its options stay in 1.13.
  • Release order: this can ship before Infrahub 1.13, because earlier releases keep the previous behaviour.

Validation of colored-help detection

The new colored-help cases fail against the previous implementation and pass with ANSI normalization, alongside the existing detection, command and warning cases. These tests ran in an isolated Go package containing the affected production declarations and the repository's test file; gofmt passed. The full package suite could not run locally because dependency downloads were denied and the embedded watchdog binaries were absent.

Original branch validation

  • Unit tests for the detection, the command and the warning. The detection fixtures are the real help texts, printed with COLUMNS=100 by the Infrahub 1.11.4 image and by a build of feat(backend): clean up old task history in the task manager and during the upgrade [INFP-507] infrahub#10869.
  • go vet, gofmt and golangci-lint v2.5.0 (0 issues), in containers.
  • End to end, with a macOS build of this branch, against a Docker Compose dev stack built from the opsmill/infrahub stack that ships 1.13:
    • flush flow-runs 7 --rewrite warned that the 7 days are ignored, then deleted 20,000 runs that ended 35 days ago and printed the per-table rewrite summary (21.4 MB before, 3.7 MB after);
    • flush flow-runs --rewrite with no days gave no warning and deleted 5,000 runs;
    • flush stale-runs completed.
  • Not run: a Kubernetes deployment, and an end-to-end run against a release before 1.13. On Kubernetes the run goes through ExecStream, which builds its kubectl exec arguments, environment included, with the same function as Exec, and returns an error when the command fails; the tool's script fallback already uses it.
  • go test ./... also fails in src/internal/updater (install_test.go:22: direct: got "container") when run inside a container, on main as well; it is unrelated to this change.

🤖 Generated with Claude Code


Summary by cubic

Fixes infrahub-taskmanager flush flow-runs on Infrahub 1.13, which removed --days-to-keep and --batch-size from infrahub tasks flush flow-runs. The tool passes both options, and since an unknown option isn't the "no such command" error that triggers its script fallback, the command failed on 1.13.

The tool now reads the command's help in the task worker to detect the Infrahub version. When 1.13 or later is detected, it runs the command without the removed flags, passes the new --rewrite flag when requested, and warns when days_to_keep or batch_size were given that they are ignored, pointing to INFRAHUB_TASK_MANAGER_RETENTION_TASK_HISTORY instead. Earlier releases keep the previous behavior, with --rewrite ignored and a warning.

Migration

  • On Infrahub 1.13+, days_to_keep and batch_size are meaningless; set INFRAHUB_TASK_MANAGER_RETENTION_TASK_HISTORY instead.

Written for commit 0dd2c44. Summary will update on new commits.

View guided diff Turn on auto-fix

…mber of days

Infrahub 1.13 removes --days-to-keep and --batch-size from
`infrahub tasks flush flow-runs`: the task manager deletes up to its own
task history retention, and --rewrite returns the disk space
(opsmill/infrahub#10869). The tool passed both options, and an unknown
option is not the "no such command" that triggers its fallback, so
`infrahub-taskmanager flush flow-runs` failed on 1.13.

The tool now reads the command's help in the task worker. When it offers
--rewrite and no --days-to-keep, the tool runs the command without days,
warns when days_to_keep or batch_size were given, and passes the new
--rewrite flag. Earlier releases keep the previous behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying infrahub-ops-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: fda7673
Status: ✅  Deploy successful!
Preview URL: https://cd02ec60.infrahub-ops-cli.pages.dev
Branch Preview URL: https://flow-runs-task-manager-reten.infrahub-ops-cli.pages.dev

View logs

saltas888 added a commit to opsmill/infrahub that referenced this pull request Oct 13, 2026
T063 records opsmill/infrahub-backup#179, which makes the maintenance
tool run `flush flow-runs` without a number of days on 1.13, and the
report lists it in the next steps. The report's commit IDs follow the
replayed stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
saltas888 added a commit to opsmill/infrahub that referenced this pull request Oct 14, 2026
T063 records opsmill/infrahub-backup#179, which makes the maintenance
tool run `flush flow-runs` without a number of days on 1.13, and the
report lists it in the next steps. The report's commit IDs follow the
replayed stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
saltas888 added a commit to opsmill/infrahub that referenced this pull request Oct 27, 2026
T063 records opsmill/infrahub-backup#179, which makes the maintenance
tool run `flush flow-runs` without a number of days on 1.13, and the
report lists it in the next steps. The report's commit IDs follow the
replayed stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
saltas888 added a commit to opsmill/infrahub that referenced this pull request Oct 28, 2026
…upports the new flush flow-runs

The tool passes --days-to-keep and --batch-size, which this change removes;
opsmill/infrahub-backup#179 makes it use the task manager's retention.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
saltas888 added a commit to opsmill/infrahub that referenced this pull request Oct 28, 2026
…upports the new flush flow-runs

The tool passes --days-to-keep and --batch-size, which this change removes;
opsmill/infrahub-backup#179 makes it use the task manager's retention.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
saltas888 added a commit to opsmill/infrahub that referenced this pull request Oct 28, 2026
T063 records opsmill/infrahub-backup#179, which makes the maintenance
tool run `flush flow-runs` without a number of days on 1.13, and the
report lists it in the next steps. The report's commit IDs follow the
replayed stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant